{% extends "base.html" %}
{% load i18n %}

{% block title %}
  {% trans "Invitation request" %}
{% endblock %}

{% block content %}
<h2>
  {% url "profiles_profile_detail" invitation.from_user.username as profile_url %}
  {% with from_name=invitation.from_user.get_full_name|default:invitation.from_user.username %}
    {% blocktrans trimmed with requestor_name=requestor_name requestor_url=requestor_url target_name=target_name target_type=target_type%}
      <a href="{{ requestor_url }}">{{ requestor_name }}</a>
      has invited you to join the
      <code>{{ target_name }}</code> {{ target_type }}.
    {% endblocktrans %}
  {% endwith %}
</h2>

{% if invitation.expired %}
<p>
  {% trans "Your invitation has expired." %}
  {% if invitation.object_type == "organization" or invitation.object_type == "team" %}
    {% trans "Ask the admin of the organization to invite you again." %}
  {% else %}
    {% trans "Ask the admin of the project to invite you again." %}
  {% endif %}
</p>
{% else %}
<p>
  {% blocktrans trimmed with valid_until=invitation.expiration_date|timeuntil expiration_date=invitation.expiration_date|date %}
    This invitation will expire in <span title="{{ expiration_date }}">{{ valid_until }}</span>.
  {% endblocktrans %}
</p>
{% endif %}

<form action="" method="post">
  {% csrf_token %}
  <input type="submit" name="accept" value="{% trans "Accept" %}" {% if invitation.expired%}disabled{% endif %}>
  <input type="submit" name="decline" value="{% trans "Decline" %}">
</form>
{% endblock %}
